package tt.com.feesmanager.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import tt.com.bodybeautymanager.mapper.DeadCosmeticMapper;
import tt.com.common.enums.Status;
import tt.com.common.enums.TollEnum;
import tt.com.common.model.DeadProject;
import tt.com.common.util.CommonResult;
import tt.com.feesmanager.mapper.DeadprojectMapper;
import tt.com.feesmanager.service.feeCollection;

@Service
public class feecollectionImpl extends ServiceImpl<DeadprojectMapper, DeadProject> implements feeCollection {
    @Override
    public CommonResult feecollection(DeadProject deadProject) {
        if (deadProject==null){
            return CommonResult.buildR(Status.DEFAULT,"不存在该服务项目");
        }else if (deadProject.getInvoiceNumber()==null){
            //如果获取的票据为空，则获取前端过来的票据，并修改库里的值
            baseMapper.insert(deadProject);
            deadProject.setChargeableStatus(TollEnum.PAYMENT_WAS_SUCCESSFUL);
            return CommonResult.buildR(Status.OK,"确认收款成功");
        }else
            return CommonResult.buildR(Status.DEFAULT,"操作失败！");
    }
}
